package ${controllerPath};
import com.bicai.common.dto.Response;
import ${servicePath}.${classInfo.className}Service;
import ${queryPath}.${classInfo.className}Query;
import ${modePath}.${classInfo.className}Co;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import javax.annotation.Resource;
import java.util.Map;
/**
 * @ClassName ${classInfo.className}
 * @Description ${classInfo.classComment}
 * @Author ${authorName}
 * @Email ${authorEmail}
 * @Date '${.now?string('yyyy-MM-dd HH:mm:ss')}'
 */
@RestController
@RequestMapping("/${classInfo.className?uncap_first}")
public class ${classInfo.className}Controller {



    @Resource
    private ${classInfo.className}Service ${classInfo.className?uncap_first}Service;

    /**
    * 新增
    */
    @RequestMapping("/insert")
    public Response<String> insert(@RequestBody ${classInfo.className}Query  ${classInfo.className?uncap_first}Query){
        return ${classInfo.className?uncap_first}Service.insert(${classInfo.className?uncap_first}Query);
    }

    /**
    * 删除
    */
    @RequestMapping("/delete")
    public Response<String> delete(int id){
        return ${classInfo.className?uncap_first}Service.delete(id);
    }

    /**
    * 更新
    */
    @RequestMapping("/update")
    public Response<String> update(@RequestBody ${classInfo.className}Query  ${classInfo.className?uncap_first}Query){
        return ${classInfo.className?uncap_first}Service.update(${classInfo.className?uncap_first}Query);
    }

    /**
    * Load查询
    */
    @RequestMapping("/load")
    public Response<${classInfo.className}Co> load(int id){
        return ${classInfo.className?uncap_first}Service.load(id);
    }

    /**
    * 分页查询
    */
    @RequestMapping("/pageList")
    public Map<String, Object> pageList(@RequestParam(required = false, defaultValue = "0") int offset,
                                        @RequestParam(required = false, defaultValue = "10") int pagesize) {
        return ${classInfo.className?uncap_first}Service.pageList(offset, pagesize);
    }

}
